﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MethodWorx.CMS.Plugins;
using MethodWorx.CMS.Services;
using System.Web.Mvc;
using MethodWorx.CMS.Content;
using MethodWorx.CMS.UI.Application.ActionResults;

namespace MethodWorx.CMS.Workflow.SendEmail
{
    public class SendEmailConfigurationController : WorkflowConfigurationController<SendEmailConfiguration>
    {
        private SchemaService schema;

        public SendEmailConfigurationController(IdeExtension view, WorkflowService service, SchemaService schema)
            : base(view, service)
        {
            this.schema = schema;
        }

        protected override WorkflowConfigurationStep CreateNewWorkflowConfigurationStep(Guid id, string output)
        {
            return new WorkflowConfigurationStep()
            {
                Id = id,
                ComponentId = SendEmailWorkflowComponent.ComponentId,
                ComponentConfiguration = new SendEmailConfiguration()
            };
        }

        protected override void ReconfigureExistingStep(WorkflowConfigurationStep step, string output)
        {
            if (output != null)
                step.Output = output;

            base.ReconfigureExistingStep(step, output);
        }     
    }
}
